<%--
  Created by IntelliJ IDEA.
  User: gaoliwei02
  Date: 17/6/25
  Time: 上午10:31
  To change this template use File | Settings | File Templates.
--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>merchant information</title>
</head>

<body>
<!-- Content Header (Page header) -->
<section class="content-header">
    <h1>
        merchant information
        <small>page</small>
    </h1>
</section>

<!-- Main content -->
<section class="content">
    <div class="box">
        <%--<div class="box-header with-border"></div><!-- /.box-header -->--%>
        <div class="box-body">
            <div class="row">

                <div class="col-lg-2  col-xs-6">
                    <label>poiid</label>
                    <input type="text" class="form-control" id="poiid_search">
                </div>

                <div class="col-lg-2  col-xs-6">
                    <label>bd name</label>
                    <input type="text" class="form-control" id="bdName_search">
                </div>

                <div class="col-lg-2  col-xs-6">
                    <label>merchant name</label>
                    <input type="text" class="form-control" id="merchantName_search">
                </div>

            </div>
        </div>
    </div>


    <table id="merchant_check_table"
           data-toggle="table"
           data-side-pagination="server"
           data-pagination="true"
    <%--data-search="true"--%>
           data-page-size="15"
           data-page-list="[15, 50, 100, 500]"
    <%--data-url="/static/json/data1.json"--%>
           data-url="/merchant/getlist.inner"
           data-row-style="rowStyle"
           data-click-to-select="true"
           data-field="state"
           data-method="post"
           data-striped="true"
           data-query-params="queryParams"
            >
        <thead>
        <tr>
            <th data-checkbox="true">check</th>
            <th data-field="poiid">poiid</th>
            <th data-field="bdName">bdName</th>
            <th data-field="registerTime">&emsp; &emsp; registerTime&emsp; &emsp; </th>
            <th data-field="rolePermission">rolePermission</th>
            <th data-field="phoneNumber">phoneNumber</th>
            <th data-field="deviceList">deviceList</th>
            <th data-field="openInfo">openInfo</th>
            <th data-field="wifi">wifi</th>
            <th data-field="cityArea">cityArea</th>
            <th data-field="merchantName">merchantName</th>
            <th data-field="merchantAddress">merchantAddress</th>
            <th data-field="usageFee">usageFee</th>
        </tr>
        </thead>

    </table>
</section>

<script>
    $(document).ready(function () {
        setInterval("search()", 30000);
    });

    function search() {
        $('#merchant_check_table').bootstrapTable('refresh', {
            query: queryParams({
                pageNumber: 1
            })
        });
    }

    function addHref() {
        $("#merchant_check_table tr").find("td:eq(1)").each(function () {
            var text = $(this).text();
            $(this).html("<a href=\"/merchant/modify/" + text + "\">" + text + "</a>");
        });
    }

    function queryParams(param) {
        var data = {
            pageSize: $(".page-size").text(),
            deviceId: $("#deviceId_search").val(),
            onlineStatus: $("#online_status_search").val(),
            statusA: $("#channalA_status_search").val(),
            statusB: $("#channalB_status_search").val(),
            mVersion: $("#m_version_search").val(),
            startTime: $('#dateStart').val(),
            endTime: $('#dateEnd').val(),
        };
        if (!data.pageSize) {
            data.pageSize = 50;
        }
        $.extend(param, data);

        setTimeout(function () {addHref();}, 1000);
        return param;
    }
</script>

</body>
</html>
